package leetcode;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.LinkedList;
import java.util.List;
import java.util.Objects;

/**
 * @Description：
 * @Author：LiDong
 * @Create：2021/3/10
 * @Version：1.0.0
 */
public class Test232 {

    private static final Logger logger = LoggerFactory.getLogger(Test232.class);



    public static void main(String[] args) {
        MyQueue myQueue = new MyQueue();
        myQueue.push(1);
        myQueue.push(2);
        logger.info(String.valueOf(myQueue.peek()));
        logger.info(String.valueOf(myQueue.pop()));
        logger.info(String.valueOf(myQueue.empty()));


    }

}

class MyQueue {

    List<Integer> list = new LinkedList<>();

    /**
     * Initialize your data structure here.
     */
    public MyQueue() {

    }

    /**
     * Push element x to the back of queue.
     */
    public void push(int x) {
        list.add(x);
    }

    /**
     * Removes the element from in front of queue and returns that element.
     */
    public int pop() {
        int num = list.get(0);
        list.remove(list.get(0));
        return num;
    }

    /**
     * Get the front element.
     */
    public int peek() {
        return list.get(0);
    }

    /**
     * Returns whether the queue is empty.
     */
    public boolean empty() {
        return Objects.isNull(list);
    }
}
